﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LanguageSchool.Model
{
    class TeacherMeta
    {
        public Teacher Teacher { get; private set; }
        public TeacherAvailability[] Availability { get; set; }

        //public TeacherAvailability MondayAvailability { get; set; }
        //public TeacherAvailability TuesdayAvailability { get; set; }
        //public TeacherAvailability WednesdayAvailability { get; set; }
        //public TeacherAvailability ThusrsdayAvailability { get; set; }
        //public TeacherAvailability FridayAvailability { get; set; }
        //public TeacherAvailability SaturdayAvailability { get; set; }

        public TeacherMeta(Teacher teacher)
        {
            this.Teacher = teacher;
            InitAvailabilities();
        }

        private void InitAvailabilities()
        {
            Availability = new TeacherAvailability[7];
            for (int i = 1; i <= 6; i++)
            {
                TeacherAvailability av = Teacher.TeacherAvailabilities.FirstOrDefault(t => t.WeekDay == i);
                if (av == null)
                {
                    av = new TeacherAvailability();
                    av.WeekDay = i;
                    Teacher.TeacherAvailabilities.Add(av);
                }
                Availability[i] = av;
            }
        }

    }
}
